function policy=pol_finder(stat)

global NO_REPLICATIONS ITERMAX NA NS SMALL TPM TRM


for state=1:NS

[maxbetafactor,index]=max(stat.beta(state,:));

policy(state)=index;

value_function(state)=stat.J(state);
relative_value_function(state)=value_function(state)-stat.J(1);
end

policy

value_function
relative_value_function
stat.beta;




